/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ucom.Entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Simon Hong
 */
@Entity
@Table(name = "customer")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Customer.findAll", query = "SELECT c FROM Customer c"),
    @NamedQuery(name = "Customer.findByCustomerID", query = "SELECT c FROM Customer c WHERE c.customerID = :customerID"),
    @NamedQuery(name = "Customer.findByCustomerName", query = "SELECT c FROM Customer c WHERE c.customerName = :customerName"),
    @NamedQuery(name = "Customer.findByCustomerAddress", query = "SELECT c FROM Customer c WHERE c.customerAddress = :customerAddress"),
    @NamedQuery(name = "Customer.findByCustomerContact", query = "SELECT c FROM Customer c WHERE c.customerContact = :customerContact")})
public class Customer implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "CustomerID")
    private Integer customerID;
    @Column(name = "CustomerName")
    private Character customerName;
    @Column(name = "CustomerAddress")
    private Character customerAddress;
    @Column(name = "CustomerContact")
    private Character customerContact;
    @OneToMany(mappedBy = "ticketCustomer", fetch = FetchType.EAGER)
    private Collection<Ticket> ticketCollection;

    public Customer() {
    }

    public Customer(Integer customerID) {
        this.customerID = customerID;
    }

    public Integer getCustomerID() {
        return customerID;
    }

    public void setCustomerID(Integer customerID) {
        this.customerID = customerID;
    }

    public Character getCustomerName() {
        return customerName;
    }

    public void setCustomerName(Character customerName) {
        this.customerName = customerName;
    }

    public Character getCustomerAddress() {
        return customerAddress;
    }

    public void setCustomerAddress(Character customerAddress) {
        this.customerAddress = customerAddress;
    }

    public Character getCustomerContact() {
        return customerContact;
    }

    public void setCustomerContact(Character customerContact) {
        this.customerContact = customerContact;
    }

    @XmlTransient
    public Collection<Ticket> getTicketCollection() {
        return ticketCollection;
    }

    public void setTicketCollection(Collection<Ticket> ticketCollection) {
        this.ticketCollection = ticketCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (customerID != null ? customerID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Customer)) {
            return false;
        }
        Customer other = (Customer) object;
        if ((this.customerID == null && other.customerID != null) || (this.customerID != null && !this.customerID.equals(other.customerID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ucom.Entity.Customer[ customerID=" + customerID + " ]";
    }
    
}
